/*this file starts after the Qualtrics SPSS file has been imported into Stata 
using Stat/Transfer*/ 

keep if gc=="1"
keep Q*

rename Q39 male
recode male (2 = 0)
rename Q31 incomecat
rename Q33_1 white
replace white = 0  if white==.
replace white=. if Q33_6==1
rename Q33_2 black
replace black=0 if black==.
replace black=. if Q33_6==1
gen raceother = 1 - white - black
rename Q41 hispanic
recode hispanic (2=0)
replace hispanic=. if hispanic==3

rename Q35 agecat
rename Q37_1 age
rename Q6 educcat
rename Q43 loccat
gen urban = (loccat==1)
replace urban = . if loccat==.
gen rural = (loccat==2)
replace rural = . if loccat==.
rename Q9_1 nep_1
rename Q9_2 nep_2
rename Q9_3 nep_3
rename Q9_4 nep_4
rename Q9_6 nep_5
rename Q39_1 nep_6
rename Q39_2 nep_7
rename Q39_3 nep_8
rename Q39_5 nep_9
rename Q39_6 nep_10
rename Q40_2 nep_11
rename Q40_3 nep_12
rename Q40_4 nep_13
rename Q40_5 nep_14
rename Q40_6 nep_15

gen nep_index = (nep_1 + nep_3 + nep_5 + nep_7 + nep_9 + nep_11 + nep_13 + nep_15 - (nep_2 + nep_4 + nep_6 + nep_8 + nep_10 + nep_12 + nep_14))*(-1)

rename Q87_1 care
rename Q88_1 knowledge
rename Q11_1 behavior
rename Q12_1 intended_pre
replace intended_pre = . if intended_pre==6
rename Q13_1 difficult
gen difficultR = -1*difficult
rename Q14_1 nature_pre
rename Q14_2 litter_pre
rename Q14_3 energy_pre
rename Q14_5 landfills_pre
rename Q15_1 good_pre
rename Q16_1 foolish
rename Q18_1 obligation_pre
rename Q37_1_0 effort
rename Q38_1 guilty_pre
rename Q19_1 peers_1
rename Q39_1_0 peers_2
rename Q40_1_0 peers_3

gen video = (Q69 != .)
rename Q69 reactvid
gen reactv_yes = (reactvid == 1)
replace reactv_yes = . if reactvid==.
gen reactv_no = (reactvid ==2)
replace reactv_no = . if reactvid ==.
gen reactv_maybe = (reactvid==3)
replace reactv_maybe = . if reactvid==.

gen text = (Q82 != .)
rename Q82 reacttext
gen reactt_yes = (reacttext == 1)
replace reactt_yes = . if reacttext==.
gen reactt_no = (reacttext ==2)
replace reactt_no = . if reacttext ==.
gen reactt_maybe = (reacttext==3)
replace reactt_maybe = . if reacttext==.

gen react_yes = 0
label var react_yes "Yes, believe behavior will change"
replace react_yes = 1 if (reactv_yes==1 | reactt_yes==1)
replace react_yes = . if (reactv_yes==. & reactt_yes==.)
gen react_no = 0
label var react_no "No, don't believe behavior will change"
replace react_no = 1 if (reactv_no==1 | reactt_no==1)
replace react_no = . if (reactv_no==. & reactt_no==.)
gen react_maybe = 0
label var react_maybe "Aren't sure whether behavior will change"
replace react_maybe = 1 if (reactv_maybe ==1 | reactt_maybe==1)
replace react_maybe = . if (reactv_no==. & reactt_no==.)

rename Q23_1 intended_post
replace intended_post = . if intended_post==6
rename Q25_1 nature_post
rename Q25_2 litter_post
rename Q25_3 energy_post
rename Q25_4 landfills_post
rename Q26_1 good_post
rename Q41_1_0 obligation_post
rename Q43_1 guilty_post

gen ch_intended = intended_post - intended_pre
gen ch_nature = nature_post - nature_pre
gen ch_litter = litter_post - litter_pre
gen ch_energy = energy_post - energy_pre
gen ch_landfills = landfills_post - landfills_pre
gen ch_good = good_post - good_pre
gen ch_obligation = obligation_post - obligation_pre
gen ch_guilty = guilty_post - guilty_pre
